package com.le.tester.leetcode;

import java.util.Arrays;

/**
 * createTime：2022/6/11 14:16
 * description：丢失的数据
 */
public class MissingNumber {
    public int missingNumber(int[] nums) {
        Arrays.sort(nums);
        int length = nums.length;
        for (int i = 0; i < length; i++) {
            if (nums[i] != i) {
                return nums[i] - 1;
            }
        }
        return nums[length - 1] + 1;
    }


    public static void main(String[] args) {
        int[] ints = {0, 1};
        System.out.println(new MissingNumber().missingNumber(ints));
    }
}
